home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / glibc-1.09 / glibc-1 / glibc-1.09.1 / mach / Makefile < prev    next >
Encoding:
Makefile  |  1994-11-01  |  7.8 KB  |  212 lines

  1. # Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
  2. # This file is part of the GNU C Library.
  3.  
  4. # The GNU C Library is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU Library General Public License
  6. # as published by the Free Software Foundation; either version 2 of
  7. # the License, or (at your option) any later version.
  8.  
  9. # The GNU C Library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. # Library General Public License for more details.
  13.  
  14. # You should have received a copy of the GNU Library General Public
  15. # License along with the GNU C Library; see the file COPYING.LIB.  If
  16. # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. # Cambridge, MA 02139, USA.
  18.  
  19. subdir := mach
  20.  
  21. all:
  22.  
  23. # Some things below (but before including Rules) use configuration variables.
  24. include ../Makeconfig
  25.  
  26.  
  27. headers = mach_init.h mach.h mach_error.h mach-shortcuts.h \
  28.       $(interface-headers) mach/mach.h mach/mig_support.h mach/error.h \
  29.       $(lock-headers) machine-sp.h
  30. distribute = thread_state.h
  31. lock = spin-solid spin-lock spin-syms mutex-solid
  32. lock-headers = lock-intern.h machine-lock.h spin-lock.h
  33. routines = $(filter-out syscall_%,$(mach-syscalls)) \
  34.        $(addprefix __,$(mach-syscalls)) \
  35.        $(mach-shortcuts) $(addprefix __,$(mach-shortcuts)) \
  36.        mach_init vm_page_size \
  37.        mig_strncpy __msg msg \
  38.        mig-alloc mig-dealloc mig-reply mig_syms \
  39.        msg_destroy msgserver msgserver_t \
  40.        __msg_dest __msgserver \
  41.        mach_error errstring error_compat errsystems \
  42.        devstream bootprivport setup-thread thread-sym $(lock)
  43. # The RPC interfaces go in a separate library.
  44. interface-library := libmachuser.a
  45. user-interfaces := $(addprefix mach/,mach_interface mach_port mach_host    \
  46.                      memory_object_user            \
  47.                      memory_object_default        \
  48.                      exc mach4                \
  49.                 )\
  50.            $(addprefix device/,device device_request)
  51. server-interfaces := device/device_reply mach/exc mach/notify
  52. tests := hello
  53. # It is important that we do not use the wildcard function to expand
  54. # `err_*.sub'.  Leaving the wildcard allows Make-dist to find all matching
  55. # files in all sysdep directories.
  56. distribute += Machrules syscalls.awk shortcut.awk \
  57.           errorlib.h err_*.sub
  58.  
  59.  
  60. # Clear any environment    value.
  61. generated =
  62.  
  63. # Get the proper definition of `mach-srcdir'.
  64. include ../sysdeps/mach/Makefile
  65.  
  66. # Use and install the Mach header files directly out of the Mach kernel source.
  67.  
  68. # Find the MiG defs files in the kernel source.
  69. vpath %.defs $(mach-srcdir)
  70.  
  71. # Install all .h and .defs files we find in some of the kernel's source
  72. # directories and their subdirectories (in MK82, max one level deep).
  73. mach-src-headers := $(wildcard $(foreach dir,mach device mach_debug \
  74.                          $(config-machine),\
  75.                      $(addprefix $(mach-srcdir)/$(dir)/,\
  76.                              *.defs *.h \
  77.                              */*.defs */*.h)))
  78. # Exclude mach/machine/*.  A symlink will be installed for mach/machine.
  79. # Exclude $(headers) for Mach files we have our own versions of.
  80. mach-headers = $(filter-out mach/machine/% $(headers),\
  81.                 $(mach-src-headers:$(mach-srcdir)/%=%))
  82. # Rename Mach's sys/version.h to mach/version.h.
  83. mach-headers := $(patsubst sys/version.h,mach/version.h,$(mach-headers))
  84.  
  85. # Don't distribute the Mach headers; they are in the Mach distribution.
  86. dont_distribute = $(mach-headers)
  87.  
  88. # DO NOT try to remake these in any way!!!
  89. $(addprefix $(mach-srcdir)/,$(mach-headers)) : ;
  90. install-others += $(addprefix $(includedir)/,$(mach-headers))
  91. $(includedir)/%: $(mach-srcdir)/%; $(do-install)
  92.  
  93. # Make symlinks for machine and mach/machine in the include directory.
  94. install-others += $(includedir)/mach/machine $(includedir)/machine
  95. $(includedir)/mach/machine $(includedir)/machine: $(common-objpfx)config.make
  96.     -rm -f $@
  97.     cd $(@D); ln -s $(config-machine) $(@F)
  98.  
  99. # Install Mach's <sys/version.h> as <mach/version.h>.
  100. install-others += $(includedir)/mach/version.h
  101. $(includedir)/mach/version.h: $(mach-srcdir)/sys/version.h; $(do-install)
  102.  
  103. # Define mach-syscalls and sysno-*.
  104. ifndef inhibit_mach_syscalls
  105. include $(objpfx)mach-syscalls.mk
  106. endif
  107. $(objpfx)mach-syscalls.mk: mach/syscall_sw.h syscalls.awk
  108. # Go kludges!!!
  109.     sed -n -e '/Unix server implement them/,$$d' \
  110.            -e 's/^kernel_trap(\(.*\),\([-0-9]*\),\([0-9]*\))$$/\1 \2 \3/p'\
  111.     < $< | awk -f $(word 2,$^) > $@-new
  112.     mv $@-new $@
  113. generated += mach-syscalls.mk
  114.  
  115. ifndef mach-syscalls
  116. # We cannot make the deps properly until we know how to make the system
  117. # call functions, and for that we must know what they all are.
  118. no_deps=t
  119. else
  120. $(mach-syscalls:%=$(objpfx)__%.S): $(objpfx)__%.S: $(objpfx)mach-syscalls.mk
  121.     (echo '#include <sysdep.h>'; \
  122.      echo 'kernel_trap(__$*,$(sysno-$*),$(nargs-$*))') > $@-new
  123.      mv $@-new $@
  124. $(mach-syscalls:%=$(objpfx)%.c): $(objpfx)%.c: Makefile
  125.     (echo '#include <gnu-stabs.h>'; \
  126.      echo 'symbol_alias (__$*, $*);') > $@-new
  127.     mv $@-new $@
  128. generated += $(mach-syscalls:%=__%.S) \
  129.          $(mach-syscalls:%=%.c)
  130. endif    # mach-syscalls
  131.  
  132. # syscall_device_writev_request has no RPC equivalent.
  133. mach-shortcuts := $(filter-out device_writev_request,\
  134.           $(patsubst syscall_%,%,$(filter syscall_%,$(mach-syscalls))))
  135.  
  136. ifndef mach-shortcuts
  137. # Forget about mach_interface.defs for this run.  On the next run,
  138. # $(mach-shortcuts) will be set, and that will change how
  139. # mach_interface.defs is processed: it will get the -D flags below.
  140. user-interfaces := $(filter-out mach/mach_interface \
  141.                 mach/mach_port mach/mach_host \
  142.                 device/device_request,\
  143.                 $(user-interfaces))
  144. endif
  145.  
  146. # Make the MiG stubs for $(mach-shortcuts) be CALL_rpc.
  147. migdefines += $(foreach call,$(mach-shortcuts),-D$(call)=$(call)_rpc)
  148. mach/mach_interface.uh mach/mach_port.uh: $(objpfx)mach-syscalls.mk
  149.  
  150. ifdef mach-shortcuts
  151. $(mach-shortcuts:%=$(objpfx)__%.c): $(objpfx)__%.c: shortcut.awk \
  152.                             $(objpfx)RPC_%_rpc.c
  153.     gawk -v call=__$* -v rpc=__$*_rpc -v syscall=__syscall_$* \
  154.          -f $^ > $@-new
  155.     mv $@-new $@
  156.  
  157. # The shortcut calls have had their names changed to CALL_rpc, so
  158. # CALL_rpc.c is being generated with a symbol alias to __CALL_rpc.  
  159. # We also want CALL.c with an alias to __CALL.
  160. $(mach-shortcuts:%=$(objpfx)%.c): $(objpfx)%.c: # Makefile
  161.     (echo '#include <gnu-stabs.h>'; \
  162.      echo 'symbol_alias (__$*, $*);') > $@-new
  163.     mv $@-new $@
  164. generated += $(mach-shortcuts:%=%.c) $(mach-shortcuts:%=__%.c)
  165. endif    # mach-shortcuts
  166.  
  167. # Generate mach-shortcuts.h, which will contain the prototypes for the
  168. # shortcutted kernel RPC functions.
  169. $(objpfx)mach-shortcuts.h: $(objpfx)mach/mach_interface.h \
  170.                $(objpfx)mach/mach_port.h
  171. # The first line gets us one paragraph per line, with @s separating real lines.
  172. # The second line selects paragraphs for the shortcutted functions.
  173. # The third line removes `_rpc' from the names and rerealifies the lines.
  174.     cat $^ | tr \\012 @ | sed s/@@/@%/g | tr % \\012 \
  175.     | grep '^/\* Routine [a-z0-9_]*_rpc \*/' \
  176.     | sed 's/_rpc//g' | tr @ \\012 > $@-new
  177.     mv $@-new $@
  178. generated += mach-shortcuts.h
  179.  
  180. before-compile += $(objpfx)mach-shortcuts.h
  181.  
  182. include Machrules
  183. include ../Rules
  184.  
  185.  
  186. # There is already a mach.h, so mach.defs generates mach_interface.h.
  187. $(objpfx)mach/mach_interface.defs: $(mach-srcdir)/mach/mach.defs
  188.     ln $< $@ || cp $< $@
  189. # There is already a memory_object.h,
  190. # so memory_object.defs generates memory_object_user.h.
  191. $(objpfx)mach/memory_object_user.defs: $(mach-srcdir)/mach/memory_object.defs
  192.     ln $< $@ || cp $< $@
  193.  
  194. ifdef objdir
  195. vpath mach/mach_interface.defs $(objdir)
  196. vpath mach/memory_object_user.defs $(objdir)
  197. endif
  198.  
  199. # Be sure not to make these with implicit rules from foo.defs.
  200. mach.h mach/memory_object.h: ;
  201.  
  202. ifeq (,)
  203. # XXX we have an errsystems.c here because a gcc bug makes the generated
  204. # version lose.
  205. else
  206. generated += errsystems.c
  207. $(objpfx)errsystems.c: errsystems.awk err_*.sub \
  208.                $(wildcard $(addsuffix /err_*.sub,$(+sysdep_dirs)))
  209.     gawk -v subsys='$(filter-out $<,$^)' -f $^ > $@.n
  210.     mv $@.n $@
  211. endif
  212.